function redirectTo(params = {}) {
    const pathname = params.pathname;
    const queryString = params.queryString !== undefined ? (params.queryString) : '';
    wx.redirectTo({
        url: `${pathname}?${queryString}`,
    });
}
function navigateTo(params = {}) {
    if (!wx) return;
    const pathname = params.pathname;
    wx.navigateTo({
        url: `${pathname}?${params.queryString}`,
    });
}
// delta 返回的页面数
function navigateBack(dept = 1) {
    if (!wx) return;
    wx.navigateBack(dept);
}

function reLaunch(params = {}) {
    if (!wx) return;
    const pathname = params.pathname;
    const queryString = params.queryString !== undefined ? (params.queryString) : '';
    wx.reLaunch({
        url: `${pathname}?${queryString}`,
    });
}

module.exports = {
    redirectTo,
    navigateTo,
    navigateBack,
    reLaunch,
};
